package com.wonders.hisdoctor.station.project.hisqueue.controller;

import com.wonders.his.common.bean.BaseResult;
import com.wonders.hisdoctor.station.project.base.domain.InfecInfo;
import com.wonders.hisdoctor.station.project.hisqueue.service.IContagionService;
import com.wonders.hisdoctor.station.project.hisqueue.vo.ContagionQueryVo;
import com.wonders.hisdoctor.station.project.hisqueue.vo.InfecDrgDictParentVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @author zhaogongming
 * @description 传染病报卡
 * @date 2021-06-21
 **/
@Api(tags = "传染病报卡")
@RestController
@RequestMapping("/contagion")
public class ContagionController {

    @Autowired
    private IContagionService contagionService;

    /**
     * 保存并打印
     * @param entity
     * @return
     */
    @ApiOperation("保存并打印")
    @PostMapping("/saveAndPrint")
    public BaseResult<InfecInfo> saveAndPrint(@RequestBody InfecInfo entity){
        return BaseResult.success(contagionService.saveAndPrint(entity));
    }

    /**
     * 查询
     * @param contagionQueryVo
     * @return
     */
    @ApiOperation("查询")
    @PostMapping("/query")
    public BaseResult<InfecInfo> query (@RequestBody @Valid ContagionQueryVo contagionQueryVo){
        return BaseResult.success(contagionService.query(contagionQueryVo));
    }

    /**
     * 查询传染病
     * @param drgType
     * @return
     */
    @ApiOperation("查询传染病")
    @GetMapping("/queryInfecDrgByType")
    public BaseResult<List<InfecDrgDictParentVo>> queryInfecDrgByType(@RequestParam("drgType") String drgType){
        return BaseResult.success(contagionService.queryInfecDrgList(drgType));
    }

}
